package com.cgq.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cgq.pojo.Phone;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * *  Author:陈国强
 * *  Description:
 * *  Date:2023/2/14 19:54
 */
@Repository
public interface PhoneMapper extends BaseMapper<Phone> {
    //查询
    @Select("select number from t_phone where id = #{id}")
    int getNumberById(@Param("id") int id);

    //更新
    @Update("update t_phone set number = number-1 where id =#{id}")
    int updateNumberById(@Param("id") int id);
}
